Skip to content

[FEATURE] Add XLIFF file processor package#392

Open
chrissonntag wants to merge 3 commits intoandreaswolf:mainfrom
chrissonntag:feature/fractor-xliff
Open

[FEATURE] Add XLIFF file processor package#392
chrissonntag wants to merge 3 commits intoandreaswolf:mainfrom
chrissonntag:feature/fractor-xliff

Conversation

@chrissonntag
Copy link
Copy Markdown
Contributor

This PR introduces a new package a9f/fractor-xliff for processing XLIFF translation files. The package supports XLIFF versions 1.0, 1.1, 1.2, and 2.0 and ships with three rules:

Code Quality / Validation:

  • EnsureXliffHasSourceLanguageFractor -- Adds a missing source language attribute, handling both v1.x (source-language) and v2.0 (srcLang).
  • EnsureXliffHasTargetLanguageFractor -- Derives the target language from the filename prefix and sets the corresponding attribute per XLIFF version.

Transformation:

  • ConvertXliff1To2Fractor -- Converts XLIFF 1.x files to the 2.0 format, restructuring elements (trans-unit to unit/segment) and remapping attributes accordingly.

The package follows the same architecture as the existing file processors (XML, YAML, etc.) with configurable file extensions, indentation settings, and full integration into the Fractor runner pipeline.

ProcessorSkipper tests have been extended to cover XliffFileProcessor alongside the five existing processors.

- ✨ Introduced `EnsureXliffHasSourceLanguageFractor` to ensure source-language attribute is present in XLIFF files.
- ✨ Introduced `EnsureXliffHasTargetLanguageFractor` to add target-language attribute based on filename.
- ✨ Added `ConvertXliff1To2Fractor` for converting XLIFF 1.2 files to XLIFF 2.0 format.
- 🧪 Created tests for the new rules with various fixture files to validate functionality.
- 📄 Added configuration files for the new rules to integrate with the Fractor framework.
- 🛠️ Implemented necessary value objects and factories for handling XLIFF documents and configurations.
@simonschaufi
Copy link
Copy Markdown
Collaborator

simonschaufi commented Apr 1, 2026

Please move the rules in the according namespace the same way as the TYPO3 rules are organized. This will have an impact in the rendering of the documentation for better clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants